<?php
namespace Home\Controller;
use Think\Controller;
class CommonController extends Controller {
    
    
    public function _initialize() {
        $site_title = "数据库字典系统";

        //检测用户的登录状态
        if(ACTION_NAME != 'login' && ACTION_NAME != 'register'){

            $this->check_login();
        }
        $this->assign("site_title",$site_title);


        $menu_class_name = CONTROLLER_NAME;
        $this->assign('menu_class_name',$menu_class_name);
    }
    


    /**
     * 检查登录状态
     */
    private function check_login(){

        $result = session('?ID_CARD');
        if(empty($result)){

            $this->redirect('Index/login');
        }
    }
}

?>
